<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <a class="brand" href="#">SoleMio (Sistema de Ventas) &nbsp;&nbsp;&nbsp;&nbsp;Bienvenido: </a>
            <div class="nav-collapse collapse">
                <p class="navbar-text pull-right">
                <h4><?php echo $this->Session->read('Auth.User.nombre'); ?></h4>
                </p>				
            </div>
            <!--/.nav-collapse -->
        </div>
    </div>
</div>

<div class="container-fluid">
    <div class="row-fluid">    
        <div class="span12">           
            <div class="hero-unit">	   
                <?php //debug($clientes); ?>
                <table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
                    <thead>
                        <tr>
                            <th>Nombre</th>
                            <th>Nit</th>
                            <th>Telefono</th>
                            <th>Pedido</th>			
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($clientes as $c): ?>
                            <?php $idCliente = $c['Cliente']['id']; ?>
                            <tr class="odd gradeX">
                                <td><?php echo $c['Cliente']['nombre']; ?></td>
                                <td><?php echo $c['Cliente']['nit']; ?></td>
                                <td><?php echo $c['Cliente']['telefono']; ?></td>
                                <td>                                    
                                    <a href="<?php echo $this->Html->url(array('action' => 'moso', $usuario, 0, $idCliente)); ?>" class="btn btn-success">Relizar Pedido</a>
                                </td>
                            </tr>		
                        <?php endforeach; ?>
                    </tbody>             
                </table>

                <!-- Button to trigger modal -->
                <a href="#myModal" role="button" class="btn btn-success" data-toggle="modal">Nuevo Cliente</a>

                <!-- Modal -->
                <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h3 id="myModalLabel">Nuevo Cliente</h3>
                    </div>
                    <div>&nbsp;</div>
                    <!--<form class="form-horizontal">-->
                    <?php echo $this->Form->create('Pedidos', array('class' => 'form-horizontal')); ?>

                    <div class="control-group">
                        <label class="control-label" for="inputEmail">Nombre</label>
                        <div class="controls">
                            <?php echo $this->Form->text('nombre'); ?>                                
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="inputEmail">Apellido para Nit</label>
                        <div class="controls">
                            <?php echo $this->Form->text('nombrenit'); ?>                                
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="inputEmail">Nit</label>
                        <div class="controls">
                            <?php echo $this->Form->text('nit'); ?>                                
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="inputEmail">Telefono</label>
                        <div class="controls">
                            <?php echo $this->Form->text('telefono'); ?>                                
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="inputEmail">Direccion</label>
                        <div class="controls">
                            <?php echo $this->Form->text('direccion'); ?>                                
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button class="btn" data-dismiss="modal" aria-hidden="true">Cerrar</button>
                        <?php //echo $this->Form->end('Guardar'); ?>
                        <button type="submit" class="btn btn-primary">Guardar y Hacer Pedido</button>
                    </div>
                    </form>
                </div>

                <script>
                    $(document).ready(function() {
                        $('#example').dataTable({
                            "bJQueryUI": false,
                            "sPaginationType": "full_numbers",
                            "oLanguage": {
                                "sProcessing": "Procesando...",
                                "sLengthMenu": "Mostrar _MENU_ registros",
                                "sZeroRecords": "No se encontraron resultados",
                                "sEmptyTable": "Ningún dato disponible en esta tabla",
                                "sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
                                "sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
                                "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
                                "sInfoPostFix": "",
                                "sSearch": "Buscar:",
                                "sUrl": "",
                                "sInfoThousands": ",",
                                "sLoadingRecords": "Cargando...",
                                "oPaginate": {
                                    "sFirst": "Primero",
                                    "sLast": "Último",
                                    "sNext": "Siguiente",
                                    "sPrevious": "Anterior"
                                }
                            }
                        });

                        //$('#myModal').modal('toggle');
                        //$('#myModal').modal();
                    });
                </script>
            </div>
            <!--/span-->        		

        </div>
        <!--/row-->
        <hr />
        <footer>
            <p>
                Desarrollado por LabWare.
            </p>
        </footer>
    </div>
    <!--/.fluid-container-->
</div>